import request from '@/config/axios'

export interface ProductAccessVO {
  id: number
  productImg: string
  productName: string
  publicityTypeId: number
  procedures: string
  modeOfRepayment: string
  timeRate: number,
  deadline:number,
  portions:number,
  multiple:number,
  rates:number,
  maxAmount: number,
  bank: string
}

// 查询产品准入列表
export const getProductAccessPage = async (params) => {
  return await request.get({ url: `/hutai/product-access/page`, params })
}

// 查询产品准入详情
export const getProductAccess = async (id: number) => {
  return await request.get({ url: `/hutai/product-access/get?id=` + id })
}

export const getConfigDataByKey = async (key) => {
  return await request.get({ url: `/hutai/product-access/getConfigDataByKey?key=` + key })
}

// 新增产品准入
export const createProductAccess = async (data: ProductAccessVO) => {
  return await request.post({ url: `/hutai/product-access/create`, data })
}

export const createCopyAccess = async (id: number) => {
  return await request.post({ url: `/hutai/product-access/createCopyAccess?id=` + id })
}

// 修改产品准入
export const updateProductAccess = async (data: ProductAccessVO) => {
  return await request.put({ url: `/hutai/product-access/update`, data })
}

// 删除产品准入
export const deleteProductAccess = async (id: number) => {
  return await request.delete({ url: `/hutai/product-access/delete?id=` + id })
}

// 导出产品准入 Excel
export const exportProductAccess = async (params) => {
  return await request.download({ url: `/hutai/product-access/export-excel`, params })
}
